1. Field of the Invention
The present invention relates to a method of, and apparatus for, mixing a plurality of images to compose a new image.
2. Description of Related Art
In the fields of industry including graphic computer, game machine, video equipment, etc., a plurality of images is mixed together according to an information on a predetermined mixing ratio to compose a new image.
FIG. 1 schematically illustrates how two images are mixed to compose a new image. In this example, a first image 41 and a second image 42 are multiplied in pixel value by 0.5, respectively, and they are added together to compose a third image 43. More particularly, a triangular part 41A of the first image 41 and a left half 41L of the second image 42 are multiplied in density by 0.5 and superposed one on the other to produce the third image 43. The third image 43 is a composite image.
For such an image composition, there have been proposed various methods different in number of images to be added together, application of mixing ratio information, etc. Among the conventional methods, xe2x80x9cOpenGLxe2x80x9d is considered to be the substantially standard interface in the field of computer graphics. The following description will be made based on the xe2x80x9cOpenGLxe2x80x9d.
It should be appreciated that the prototype of the xe2x80x9cOpenGLxe2x80x9d was made by the SiliconGraphics in the United States of America, and the xe2x80x9cOpenGLxe2x80x9d is under the management of the Architecture Review Board (ARB) for the OpenGL.
Assume here that the first image has a pixel value Cs while the second image has a pixel value Cd. The pixel values Cs and Cd are expressed as follows:
Cs=(Rs, Gs, Bs, As)xe2x80x83xe2x80x83(1)
Cd=(Rd, Gd, Bd, Ad)xe2x80x83xe2x80x83(2)
where Rs, Gs and Bs are pixel color information of the first image and correspond to red (R), green (G) and blue (B), respectively; As is an additional information of the first image pixel, also called xe2x80x9calpha informationxe2x80x9d; Rd, Gd and Bd are pixel color information of the second image and correspond to red (R), green (G) and blue (B), respectively; Ad is an additional information of the second image pixel, also called xe2x80x9calpha informationxe2x80x9d.
Since the image data is generally represented in units of 8 bits, the above three color information components are represented with 24 units. In various data equipment in which image data are handled in units of 32 bits, for example, however, a blank channel for 8 bits will take place. The blank channel for 8 bits is used to handle the additional information As and Ad along with the color information.
The first image is mixed with the second images with the first image multiplied by a mixing factor S represented by any one of the following eight expressions (3-1) to (3-8):                               S          =                      xe2x80x83                    ⁢                      (                          0              ,              0              ,              0              ,              0                        )                          ,                  xe2x80x83                ⁢        or                                      xe2x80x83                ⁢                  (                      3            ⁢                          -                        ⁢            1                    )                                                  =                      xe2x80x83                    ⁢                      (                          1              ,              1              ,              1              ,              1                        )                          ,                  xe2x80x83                ⁢        or                                      xe2x80x83                ⁢                  (                      3            ⁢                          -                        ⁢            2                    )                                                  =                      xe2x80x83                    ⁢                      (                          Rd              ,              Gd              ,              Bd              ,              Ad                        )                          ,                  xe2x80x83                ⁢        or                                      xe2x80x83                ⁢                  (                      3            ⁢                          -                        ⁢            3                    )                                                  =                      xe2x80x83                    ⁢                                    (                              1                ,                1                ,                1                ,                1                            )                        -                          (                              Rd                ,                Gd                ,                Bd                ,                Ad                            )                                      ,                  xe2x80x83                ⁢        or                                      xe2x80x83                ⁢                  (                      3            ⁢                          -                        ⁢            4                    )                                                  =                      xe2x80x83                    ⁢                      (                          As              ,              As              ,              As              ,              As                        )                          ,                  xe2x80x83                ⁢        or                                      xe2x80x83                ⁢                  (                      3            ⁢                          -                        ⁢            5                    )                                                  =                      xe2x80x83                    ⁢                                    (                              1                ,                1                ,                1                ,                1                            )                        -                          (                              As                ,                As                ,                As                ,                As                            )                                      ,                  xe2x80x83                ⁢        or                                      xe2x80x83                ⁢                  (                      3            ⁢                          -                        ⁢            6                    )                                                  =                      xe2x80x83                    ⁢                      (                          Ad              ,              Ad              ,              Ad              ,              Ad                        )                          ,                  xe2x80x83                ⁢        or                                      xe2x80x83                ⁢                  (                      3            ⁢                          -                        ⁢            7                    )                                        =                  xe2x80x83                ⁢                              (                          1              ,              1              ,              1              ,              1                        )                    -                      (                          Ad              ,              Ad              ,              Ad              ,              Ad                        )                                                        xe2x80x83                ⁢                  (                      3            ⁢                          -                        ⁢            8                    )                    
Similarly, the second image is mixed with the first images with the second image multiplied by a mixing factor D represented by any one of the following eight expressions (4-1) to (4-8):                               D          =                      xe2x80x83                    ⁢                      (                          0              ,              0              ,              0              ,              0                        )                          ,                  xe2x80x83                ⁢        or                                      xe2x80x83                ⁢                  (                      4            ⁢                          -                        ⁢            1                    )                                                  =                      xe2x80x83                    ⁢                      (                          1              ,              1              ,              1              ,              1                        )                          ,                  xe2x80x83                ⁢        or                                      xe2x80x83                ⁢                  (                      4            ⁢                          -                        ⁢            2                    )                                                  =                      xe2x80x83                    ⁢                      (                          Rs              ,              Gs              ,              Bs              ,              As                        )                          ,                  xe2x80x83                ⁢        or                                      xe2x80x83                ⁢                  (                      4            ⁢                          -                        ⁢            3                    )                                                  =                      xe2x80x83                    ⁢                                    (                              1                ,                1                ,                1                ,                1                            )                        -                          (                              Rs                ,                Gs                ,                Bs                ,                As                            )                                      ,                  xe2x80x83                ⁢        or                                      xe2x80x83                ⁢                  (                      4            ⁢                          -                        ⁢            4                    )                                                  =                      xe2x80x83                    ⁢                      (                          As              ,              As              ,              As              ,              As                        )                          ,                  xe2x80x83                ⁢        or                                      xe2x80x83                ⁢                  (                      4            ⁢                          -                        ⁢            5                    )                                                  =                      xe2x80x83                    ⁢                                    (                              1                ,                1                ,                1                ,                1                            )                        -                          (                              As                ,                As                ,                As                ,                As                            )                                      ,                  xe2x80x83                ⁢        or                                      xe2x80x83                ⁢                  (                      4            ⁢                          -                        ⁢            6                    )                                                  =                      xe2x80x83                    ⁢                      (                          Ad              ,              Ad              ,              Ad              ,              Ad                        )                          ,                  xe2x80x83                ⁢        or                                      xe2x80x83                ⁢                  (                      4            ⁢                          -                        ⁢            7                    )                                        =                  xe2x80x83                ⁢                              (                          1              ,              1              ,              1              ,              1                        )                    -                      (                          Ad              ,              Ad              ,              Ad              ,              Ad                        )                                                        xe2x80x83                ⁢                  (                      4            ⁢                          -                        ⁢            8                    )                    
Therefore, the first and second image are mixed in 64 different expressions (8xc3x978 expressions of the mixing factor).
The pixel value Cb of an image resulted from the above mixing is given by the following expression (5). However, it should be noted that the expression (5) should be calculated for each component.
Cb=Cs*S+Cd*Dxe2x80x83xe2x80x83(5)
FIG. 2 shows an example of the configuration of the image mixing circuit which use the expression (5) to make a calculation for the mixing of two images.
In FIG. 2, the reference MUX51 indicates a means for selecting any one of 8 mixing factors given by the expressions (3-1) to (3-8), and the reference MUX53 indicates a means for selecting any one of 8 mixing factors given by the expressions (4-1) to (4-8). The means MUX51 outputs a mixing factor S for the first image to a multiplying means 52 in which it is multiplied by the pixel value Cs of the first image. The means MUX53 outputs a mixing factor D for the second image to a multiplying means 54 in which it is multiplied by the pixel value Cd of the second image.
Outputs from the multiplying means 52 and 54 are added together in an adding means 55 to produce a composite image (Cs*S+Cd*D).
For production of a composite image using the expression (5), two times of multiplication and one addition are required for each image component.
Generally, the multiplication takes a longer time than the addition and the circuit scale of a multiplier is larger than that of an adder. Therefore, when the image mixing circuit is configured to make a calculation of image mixing for all possible combinations of the mixing factors S and D, the hardware scale will be too large.
Accordingly, the present invention has an object to overcome the above-mentioned drawbacks of the prior art by providing an image composing method and apparatus capable of a high speed calculation with no increased hardware scale.
The above object can be accomplished by providing a method of mixing first and second images to produce a composite image, comprising, according to the present invention, a first step of multiplying the first image pixel value by a first factor, a second step of multiplying the second image pixel value by a second factor, and a step of adding the first image pixel value multiplied by the first factor and the second image pixel value multiplied by the second factor, any one of the first and second factors being 1 or 0, alternatively, the sum of the two factors being 1.
The above object can also be accomplished by proving a method of mixing first and second images to produce a composite image, comprising, according to the present invention, a step of making a subtraction between the first and second image pixel values to determine a pixel value difference, a step of multiplying the result of the subtraction by a selected mixing factor, and a step of adding the result of the multiplication to the pixel value of any selected one of the first and second images.
The above object can also be accomplished by providing an apparatus for mixing first and second images to produce a composite image, comprising, according to the present invention, a first means for multiplying the first image pixel value by a first factor, a second means for multiplying the second image pixel value by a second factor, and means for adding the first image pixel value multiplied by the first factor and the second image pixel value multiplied by the second factor, any one of the first and second factors being 1 or 0, alternatively, the sum of the two factors being 1.
The above object can also be accomplished by proving an apparatus for mixing first and second images to produce a composite image, comprising, according to the present invention, means for making a subtraction between the first and second image pixel values to determine a pixel value difference, means for multiplying the result of the subtraction by a selected mixing factor, and means for adding the result of the multiplication to the pixel value of any selected one of the first and second images.
The present invention can provide an image composing method and apparatus adapted to make a high speed calculation with no increased hardware scale.